//
// Created by thinkpad on 16-12-24.
//题目，求一个3×3 矩阵的对角线元素和
#include <stdio.h>

#define N 3
//此处只求了右下斜的对角线元素和

int main(){
    int i,j,a[N][N],sum=0;
    printf("Please input 3 * 3 rect : \n");
    for (i = 0; i < N; ++i) {
        for (j = 0; j < N; ++j) {
            scanf("%d",&a[i][j]);
        }
    }
    for (i = 0; i < N; ++i) {
        sum+=a[i][i];
    }
    printf("result : %d \n",sum);
    return 0;
}

